_init: function() {
PanelMenu.Button.prototype._init.call(this, St.Align.START);
this._metaDisplay = global.screen.get_display();
+ this._startingApps = [];
- this._focusedApp = null;
+ this._targetApp = null;
let bin = new St.Bin({ name: 'appMenu' });
this.actor.set_child(bin);
tracker.connect('notify::focus-app', Lang.bind(this, this._sync));
tracker.connect('app-state-changed', Lang.bind(this, this._onAppStateChanged));
+ global.window_manager.connect('switch-workspace', Lang.bind(this, this._sync));
+
this._sync();
},
_onAppStateChanged: function(tracker, app) {
let state = app.state;
- if (app == this._lastStartedApp
- && state != Shell.AppState.STARTING) {
- this._lastStartedApp = null;
+ if (state != Shell.AppState.STARTING) {
+ this._startingApps = this._startingApps.filter(function(a) {
+ return a != app;
+ });
} else if (state == Shell.AppState.STARTING) {
- this._lastStartedApp = app;
+ this._startingApps.push(app);
}
// For now just resync on all running state changes; this is mainly to handle
// cases where the focused window's application changes without the focus
_sync: function() {
let tracker = Shell.WindowTracker.get_default();
+ let lastStartedApp = null;
+ let workspace = global.screen.get_active_workspace();
+ for (let i = 0; i < this._startingApps.length; i++)
+ if (this._startingApps[i].is_on_workspace(workspace))
+ lastStartedApp = this._startingApps[i];
let focusedApp = tracker.focus_app;
- if (focusedApp == this._focusedApp) {
- if (focusedApp && focusedApp.get_state() != Shell.AppState.STARTING)
+ let targetApp = focusedApp != null ? focusedApp : lastStartedApp;
+ if (targetApp == this._targetApp) {
+ if (targetApp && targetApp.get_state() != Shell.AppState.STARTING)
this.stopAnimation();
return;
- } else {
- this._stopAnimation();
}
+ this._stopAnimation();
if (!focusedApp) {
// If the app has just lost focus to the panel, pretend
this._label.setText('');
this.actor.reactive = false;
- this._focusedApp = focusedApp;
-
- let targetApp = this._focusedApp != null ? this._focusedApp : this._lastStartedApp;
+ this._targetApp = targetApp;
if (targetApp != null) {
let icon = targetApp.get_faded_icon(2 * PANEL_ICON_SIZE);
{
GObject parent;
+ int started_on_workspace;
+
ShellAppState state;
ShellAppInfo *info;
{
GSList *iter;
+ if (shell_app_get_state (app) == SHELL_APP_STATE_STARTING)
+ {
+ if (meta_workspace_index (workspace) == app->started_on_workspace)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
if (app->running_state == NULL)
return FALSE;
shell_app_state_transition (app, SHELL_APP_STATE_STARTING);
meta_display_focus_the_no_focus_window (display, screen,
sn_startup_sequence_get_timestamp (sequence));
+ app->started_on_workspace = sn_startup_sequence_get_workspace (sequence);
}
if (!starting)